package ru.ifmo.swing;

import javax.swing.*;
import java.awt.*;

/**
 * Why?
 * Because spring for some reason have problems with overloaded setters (like setSize()).
 *
 * @author avhaliullin
 */
public class SpringCompatibleFrame extends JFrame {
    {
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
    }

    public void setDimension(Dimension dimension) {
        setSize(dimension);
    }

    public void setComponentsList(java.util.List<JComponent> components) {
        getContentPane().removeAll();
        for (JComponent component : components) {
            getContentPane().add(component);
        }
    }
}
